package com.woniuxy.service.impl;

import com.woniuxy.dao.SkillDao;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.entity.Skill;
import com.woniuxy.service.SkillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @ClassName SkillServiceImpl
 * @Description TODO
 * @Author 冯浩波
 * @Date 2022/3/8 16:37
 */
@Service
public class SkillServiceImpl implements SkillService{
        @Autowired(required = false)
        SkillDao skillDao;
    @Override
    public ResponseEntity addSkill(Skill skill) {
        int res = skillDao.createSkill(skill);
            if(res>0){
                return new ResponseEntity(200,"创建成功！",null);
            }else {
                return new ResponseEntity(500,"系统维护中",null);
            }
    }

    @Override
    public ResponseEntity findSkill( int id) {
        Skill skill = skillDao.findSkill(id);
        if(skill!=null){
            return new ResponseEntity(200,"查询成功！",skill);
        }else {
            return new ResponseEntity(500,"系统维护中",null);
        }
    }

    @Override
    public ResponseEntity updataSkill(Skill skill) {
        int res = skillDao.updateSkill(skill);
        if(res > 0 ){
            return new ResponseEntity(200,"更新成功",null);
        }else {
            return new ResponseEntity(500,"系统维护中",null);
        }
    }
}
